import request from '@/utils/request'
import FormatPackage from '@/utils/response-format-package'

export function getAccountList(params = {}) {
  return request({
    url: '/account/listAccount',
    method: 'get',
    params
  })
}
export function resetAccountPassword(params = {}) {
  return request({
    url: '/account/resetAccount',
    method: 'get',
    params
  })
}
export function changeOperationAccountStatus(params = {}) {
  return request({
    url: '/account/operationAccountStatus',
    method: 'get',
    params
  })
}

export function addAccount(params = {}) {
  return request({
    url: '/account/addAccount',
    method: 'get',
    params
  })
}

export function updateAccount(params = {}) {
  return request({
    url: '/account/updateAccount',
    method: 'get',
    params
  })
}

export function getAccountInfo(params = {}, defaultMsg) {
  return FormatPackage(
    request({
      url: '/account/getAccountInfo',
      method: 'get',
      params
    }),
    defaultMsg
  )
}

export function getRoleList(params = {}, defaultMsg) {
  return FormatPackage(
    request({
      url: '/role/getRoleList',
      method: 'get',
      params: {
        pageIndex: 1,
        pageOffset: 1000,
        roleName: '',
        roleFunctional: '',
        ...params
      }
    }),
    defaultMsg
  )
}
export function deleteRole(params = {}, defaultMsg) {
  return FormatPackage(
    request({
      url: '/role/deleteRole',
      method: 'get',
      params
    }),
    defaultMsg
  )
}
export function getRoleAllTree(params = {}, defaultMsg) {
  return FormatPackage(
    request({
      url: '/role/getMenuTree',
      method: 'get',
      params
    }),
    defaultMsg
  )
}
export function addRole(params = {}, defaultMsg) {
  return FormatPackage(
    request({
      url: '/role/addRole',
      method: 'get',
      params
    }),
    defaultMsg
  )
}

export function updateRole(params = {}, defaultMsg) {
  return FormatPackage(
    request({
      url: '/role/updateRole',
      method: 'get',
      params
    }),
    defaultMsg
  )
}
export function getRoleDetail(params = {}, defaultMsg) {
  return FormatPackage(
    request({
      url: '/role/getRoleInfo',
      method: 'get',
      params
    }),
    defaultMsg
  )
}

